<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" th:fragment="layout(title,links,page_script)">
<head>
<title th:replace="${title}"></title>
<meta http-equiv="x-ua-compatible" content="IE=9,10">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<!-- bootstrap -->
<link rel="stylesheet" type="text/css" th:href="@{/webjars/bootstrap/3.3.6/css/bootstrap.min.css}">
<!-- font-awesome -->
<link rel="stylesheet" type="text/css" th:href="@{/webjars/font-awesome/4.7.0/css/font-awesome.min.css}">
<!-- Theme style -->
<link rel="stylesheet" href="/webjars/adminlte/2.3.11/dist/css/AdminLTE.min.css" th:href="@{/webjars/adminlte/2.3.11/dist/css/AdminLTE.min.css}">
<link rel="stylesheet" href="/webjars/adminlte/2.3.11/dist/css/skins/skin-purple-light.min.css" th:href="@{/webjars/adminlte/2.3.11/dist/css/skins/skin-purple-light.min.css}">
<!--[if lt IE 9]>
<script src="/webjars/html5shiv/3.7.3/html5shiv.min.js" th:src="@{/webjars/html5shiv/3.7.3/html5shiv.min.js}" type="text/javascript"></script>
<script src="/webjars/respond/1.4.2/dest/respond.min.js" th:src="@{/webjars/respond/1.4.2/dest/respond.min.js}" type="text/javascript"></script>
<![endif]-->
<style type="text/css">
.error {
	color: red;
}
</style>
<th:block th:replace="${links}" />
</head>
<body class="hold-transition skin-purple-light sidebar-collapse fixed sidebar-mini" id="_layout">
	<!-- Site wrapper -->
	<div class="wrapper">
		<th:block th:replace="admin/_inc/_header :: header" />
		<!-- Left side column. contains the logo and sidebar -->
		<th:block th:replace="admin/_inc/_menu :: menu" />
		<!-- Content Wrapper. Contains page content -->
		<div class="content-wrapper">
			<!-- Content Header (Page header) -->
			<section class="content-header">
				<h1 style="width: 60%">&nbsp;</h1>
			</section>
			<section style="height: 100%">
			<th:block th:include="::content" />
			</section>
		</div>
		<!-- /.content-wrapper -->
		<th:block th:replace="admin/_inc/_header :: footer" />
	</div>
	<!-- ./wrapper -->
	<script type="text/javascript" charset="UTF-8" th:src="@{/webjars/jquery/1.11.1/jquery.min.js}"></script>
	<!-- datatables -->
	<script type="text/javascript" charset="UTF-8" th:src="@{/webjars/bootstrap/3.3.6/js/bootstrap.min.js}"></script>
	<!-- lhgdialog -->
	<script type="text/javascript" charset="UTF-8" th:src="@{/webjars/lhgdialog/4.2.0/lhgdialog.min.js?skin=bootstrap2}"></script>
	<!-- jquery-framework-ext -->
	<script type="text/javascript" charset="UTF-8" th:src="@{/webjars/framework-ext/1.0.0/jquery/js/jquery-framework-ext.js}"></script>
	<!-- SlimScroll AdminLTE App the fixed layout requires the slimscroll plugin-->
	<script type="text/javascript" th:src="@{/webjars/adminlte/2.3.11/plugins/slimScroll/jquery.slimscroll.min.js}"></script>
	<!-- AdminLTE App -->
	<script src="/webjars/adminlte/2.3.11/dist/js/app.min.js" type="text/javascript" th:src="@{/webjars/adminlte/2.3.11/dist/js/app.min.js}"></script>
	
	<script th:inline="javascript" type="text/javascript">
        //var userId = '[(${session.userName})]';
        $(function() {
            initTree();
            fix();
            initUrls();
        });
		function initTree(){
		    [# th:if="${session.active_menu != null and session.active_menu.parentId !=null}" ]
		    $('.sidebar-menu').find(#[(${session.active_menu.parentId})]).attr("class","treeview active");
			[/]	
			[# th:if="${session.active_menu != null and session.active_menu.id !=''}" ]
			$('.sidebar-menu').find("#[(${session.active_menu.id})]").attr("class","active");
			[/]
		
		};

        function fix() {
            var neg = $('.main-header').outerHeight() + $('.main-footer').outerHeight();
            var window_height = $(window).height();
            var sidebar_height = $(".sidebar").height();
            if (window_height >= sidebar_height + neg) {
                $(".content-wrapper, .right-side").css('min-height', window_height - neg);
            } else {
                $(".content-wrapper, .right-side").css('min-height', sidebar_height);
            }
        };

        function initUrls() {
            $(".treeview-menu").each(function() {
                var pid = $(this).parent().attr("id");
                if (typeof (pid) == 'undefined' || null == pid) {
                    return;
                }
                $(this).find('a').each(function() {
                    var href = $(this).attr("href");
                    $(this).attr("href", href);
                });
            });
        };
    </script>
    <script th:replace="${page_script}"></script>
</body>
</html>